package form.ui.core {
	public class ButtonToggle extends Toggle {
		public function ButtonToggle() 
		{
			super();
			
			this.registerStyle("onUpSkin");
			this.registerStyle("onOverSkin");
			this.registerStyle("onDownSkin");
			this.registerStyle("onDisableSkin");
			
			this.registerStyle("offUpSkin");
			this.registerStyle("offOverSkin");
			this.registerStyle("offDownSkin");
			this.registerStyle("offDisableSkin");
			
			this.mouseChildren = true;
		}
		
		public override function enable():void {
			super.enable();
			
			if (this.on !=  null && this.on is Button) {
				Button(this.on).enable();
			}
			
			if (this.off !=  null && this.off is Button) {
				Button(this.off).enable();
			}
		}
		
		public override function disable():void {
			super.disable();
			
			if (this.on !=  null && this.on is Button) {
				Button(this.on).disable();
			}
			
			if (this.off !=  null && this.off is Button) {
				Button(this.off).disable();
			}
		}
		
		protected override function showDisabled():void {
			this.clickable = false;
		}
		
		protected override function set clickable(value:Boolean):void {
			if (!this.enabled) { value = false; }
			
			super.clickable = value;	 
		}
		
		protected override function get clickable():Boolean {
			return super.clickable;
		}
		public function set onUpSkin(value:String):void
		{
			Button(on).upSkin = value;
		}
		public function set onOverSkin(value:String):void
		{
			Button(on).overSkin = value;
		}
		public function set onDownSkin(value:String):void
		{
			Button(on).downSkin = value;
		}
		public function set onDisableSkin(value:String):void
		{
			Button(on).disabledSkin = value;
		}
		
		public function set offUpSkin(value:String):void
		{
			Button(off).upSkin = value;
		}
		public function set offOverSkin(value:String):void
		{
			Button(off).overSkin = value;
		}
		public function set offDownSkin(value:String):void
		{
			Button(off).downSkin = value;
		}
		public function set offDisableSkin(value:String):void
		{
			Button(off).disabledSkin = value;
		}
		
	}
}